using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;

namespace WebApiFrame.Filters
{
    public class SimpleActionFilterAttribute : Attribute, IActionFilter
    {
        private readonly ILogger<SimpleActionFilterAttribute> logger;
        public SimpleActionFilterAttribute(ILoggerFactory loggerFactory)
        {
        logger=loggerFactory.CreateLogger<SimpleActionFilterAttribute>();
        }
        public void OnActionExecuted(ActionExecutedContext context)
        {
          logger.LogInformation("方法过滤器 OnActionExecuted");
        }

        public void OnActionExecuting(ActionExecutingContext context)
        {
                 logger.LogInformation("方法过滤器 OnActionExecuting");
        }
    }
}